#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e5+10;

int n,L,q,x[MAXN],f[MAXN][22];

int main (){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++) scanf("%d",&x[i]);
	scanf("%d",&L);scanf("%d",&q);
	for(int i = 1;i <= n;i++){
		f[i][0] = f[i-1][0];
		while(f[i][0] < n && x[f[i][0]+1] - x[i] <= L) f[i][0]++;
	}
	for(int k = 1;k < 22;k++)
		for(int i = 1;i <= n;i++)
			f[i][k] = f[f[i][k-1]][k-1];
	while(q--){
		int l,r;scanf("%d %d",&l,&r);if(l > r) swap(l,r);
		int tot = 0;
		for(int i = 21;i >= 0;i--)
			if(f[l][i] && f[l][i] < r) l = f[l][i],tot += 1<<i;
		printf("%d\n",tot+1);
	}
	return 0;
}
